#include <cstdio>
#include <iostream>
#include <string>

typedef struct 
{
	int x, y;
	int order; // 0-N, 1-E, 2-S, 3-W
}typem;

typem r[110];
int w, h, n, m;
int move[4][2]={{0,1},
				{1,0},
				{0,-1},
				{-1,0}};
bool ok;

int chtoint(char ch)
{
	
	switch (ch)
	{
		case 'N':
		case 'n': return 0; break;
		case 'E':
		case 'e': return 1; break;
		case 'S':
		case 's': return 2; break;
		case 'W':
		case 'w': return 3; break;
	}
//	printf("error in fuction chtoint ch=%c\n", ch);
	
}

bool check(int a)
{
	int i;
	if (r[a].x == 0 || r[a].y == 0 || r[a].x > w || r[a].y > h)
	{
		printf("Robot %d crashes into the wall\n", a);
		ok = false;
		return false;
	}
	for (i=1; i<=n; ++i)
		if (i!=a)
		{
			if (r[i].x == r[a].x && r[i].y == r[a].y)
			{
				printf("Robot %d crashes into robot %d\n", a, i);
				ok=false;
				return false;
			}
		}
	return true;
	
	
}

void readanddo()
{
	int i,k;
	int a, step, order;
	char ch[10];
	for (k=1; k<=m; ++k)
	{
		scanf("%d%s%d", &a, ch, &step);
		if (!ok) continue;
		order = r[a].order;
		if (ch[0]=='F' || ch[0]=='f' )
		{
			for (i=1; i<=step; ++i)
			{
				r[a].x += move[order][0];
				r[a].y += move[order][1];
				if (ok) check(a);
			}
		}
		else if (ch[0] == 'L' || ch[0] == 'l')
		{
			for (i=1; i<=step; ++i)
				r[a].order = (r[a].order+3)%4;
		}
		else if (ch[0] == 'R' || ch[0] == 'r')
		{
			for (i=1; i<=step; ++i)
				r[a].order = (r[a].order+1)%4;
		}
		
		
		
		
	}
	
	
}


int main()
{
	int ncase, i;
	char ch[10];
	
//	freopen("ain.txt", "r", stdin);
//	freopen("aout.txt", "w", stdout);
	
	scanf("%d", &ncase);	
	while (ncase--)
	{
		scanf("%d%d", &w, &h);
		scanf("%d%d", &n, &m);
		for (i=1; i<=n; ++i)
		{
			scanf("%d%d", &r[i].x, &r[i].y);
			scanf("%s", ch);
			r[i].order = chtoint(ch[0]);			
		}
		ok = true;
		readanddo();
		if (ok==true) printf("OK\n");
		
	}
	
	
	return 0;	
}


